﻿using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.InterceptionExtension;

namespace TSharp.Core.Aop.Handler
{
	/// <summary>
	/// 
	/// <para>2010/9/27</para>
	/// 	<para>TANGJINGBO</para>
	/// 	<author>tangjingbo</author>
	/// </summary>
	public class CacheHandler : CallHandlerBase
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="CacheHandler"/> class.
		/// </summary>
		/// <param name="container">The container.</param>
		public CacheHandler(IUnityContainer container)
			: base(container, 0)
		{
		}

		#region ICallHandler 成员

		/// <summary>
		/// Implement this method to execute your handler processing.
		/// </summary>
		/// <param name="input">Inputs to the current call to the target.</param>
		/// <param name="getNext">Delegate to execute to get the next delegate in the handler
		/// chain.</param>
		/// <returns>
		/// Return value from the target.
		/// </returns>
		public override IMethodReturn Invoke(IMethodInvocation input, GetNextHandlerDelegate getNext)
		{
			return getNext()(input, getNext);
		}

		#endregion
	}
}